<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>${baseInfo.tableComment}基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<#noparse>${ctx}</#noparse>/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="<#noparse>${ctx}</#noparse>/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="<#noparse>${ctx}</#noparse>/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "<#noparse>${ctx}</#noparse>";
    </script>
    <style>
        .qbdms-TBinformation{margin-left: 0;font-size: 15px}
        .treeFormPreview{
            bottom: 42px;
        }
    </style>
</head>
<body class="listBody">
<div class="qbdms-bodyDiv">
    <div class="qbdms-backDiv">
        <div class="layui-table-view-body" style="padding: 0 24px 24px;">
            <div class="qbdms-formTitle" style="border-bottom: 1px solid #E5F0FF">${baseInfo.tableComment} <i class="qbdms-returnOn closeWindow">返回</i></div>
            <form class="layui-form treeFormPreview"  requrl="<#noparse>${ctx}</#noparse>/${baseInfo.moduleName}/${baseInfo.classForPrefix}/get" lay-filter="${baseInfo.classForPrefix}DataForm">
            <#assign colIndex=0>
            <#assign index=0>
            <#assign rowSize=codeGenConf.rowSize>
            <#assign colSize=codeGenConf.colSize>
            <#assign columnSize=codeGenConf.columnSize>
            <#assign hideRowSize=codeGenConf.hideRowSize>
            <div class="layui-row">
                <#list 0..rowSize-1 as i>
                    <#list 0..columnSize as col>
                        <div class="" style="width: 45%">
                            <label class="layui-form-label qbdms-label" title="${baseInfo.showColumns[index].columnComment!}">${baseInfo.showColumns[index].columnComment!}</label>
                            <div class="layui-input-block qbdms-input">
                                <input type="text" placeholder="请输入" autocomplete="off" class="layui-input<#if baseInfo.showColumns[index].attrType?? && baseInfo.showColumns[index].attrType == 'Date'> dateTimeFiled input-right time-init<#else> textInput</#if>" name="${baseInfo.showColumns[index].attrNameForProperty}" maxlength="${(baseInfo.showColumns[index].dataLength?number)?c}">
                            </div>
                        </div>
                        <#assign lastData=index == columnSize -1>
                        <#assign index=index+1>
                        <#assign colIndex=colIndex+1>
                        <#if colIndex % colSize == 0><#break /></#if>
                        <#if lastData><#break /></#if>
                    </#list>
                </#list>
            </div>

            <#if hideColumnSize>
                <#assign hideIndex=0>
                <#assign hideColIndex=0>
                <#assign hideRowSize=codeGenConf.hideRowSize>
                <#assign hideColumnSize=codeGenConf.hideColumnSize>
                <#list 0..hideRowSize-1 as i>
                    <div class="layui-hide">
                        <#list 0..hideColumnSize as col>
                            <div class="" style="width: 45%">
                                <label class="layui-form-label qbdms-label">${baseInfo.hideColumns[hideIndex].columnComment!}</label>
                                <div class="layui-input-block qbdms-input">
                                    <input type="text" placeholder="请输入" autocomplete="off" class="layui-input <#if baseInfo.hideColumns[hideIndex].attrType?? && baseInfo.hideColumns[hideIndex].attrType == 'Date'>dateTimeFiled time-init</#if>" name="${baseInfo.hideColumns[hideIndex].attrNameForProperty}" maxlength="50">
                                </div>
                            </div>
                            <#assign lastData=hideIndex == hideColumnSize -1>
                            <#assign hideIndex=hideIndex+1>
                            <#assign hideColIndex=hideColIndex+1>
                            <#if hideColIndex % colSize == 0><#break /></#if>
                            <#if lastData><#break /></#if>
                        </#list>
                    </div>
                </#list>
            </#if>
            <div class="layui-form-item" style="margin-top: 48px">
                <p style="text-align: left;margin-left: 145px;">
                    <#if selectFlow?? && selectFlow != "">
                        <span id="hideAndShow" style="display: none;">
                            <a lay-submit lay-filter="${baseInfo.classForPrefix}" class="layui-btn btn-n privateSubmit qbdms-oneBtn" requrl="<#noparse>${ctx}</#noparse>/${baseInfo.moduleName}/${baseInfo.classForPrefix}/save">提交</a>
                            <a lay-filter="${baseInfo.classForPrefix}" id="run" class="layui-btn btn-n">启动</a>
                        </span>
                    <#else>
                        <span id="hideAndShow" style="display: none;">
                            <a lay-submit lay-filter="${baseInfo.classForPrefix}" class="layui-btn btn-n privateSubmit qbdms-oneBtn" requrl="<#noparse>${ctx}</#noparse>/${baseInfo.moduleName}/${baseInfo.classForPrefix}/save">提交</a>
                        </span>
                    </#if>
                    <button type="reset" id="closeWindow" style="margin-left: 10px;" class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">取消</button>
                </p>
            </div>
        </form>
        </div>
    </div>
</div>
<script src="<#noparse>${ctx}</#noparse>/qbdmsStatic/public/configFile.js"></script>
<script src="<#noparse>${ctx}</#noparse>/layui/layui.js"></script>
<script>
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'setter', 'layer', 'propsHandle', 'upload', 'common', 'laydate', 'jquery', 'publicMethods', 'qbdmsForm'], function () {
        var $ = layui.jquery,
            laydate = layui.laydate,
            setter = layui.setter,  // 配置信息
            layer = layui.layer,
            common = layui.common,
            propsHandle = layui.propsHandle,
            upload = layui.upload,
            publicMethods = layui.publicMethods,
            formId = '${formDefId}' || '',
            defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                initCss: [
                    'style/currencyCss'
                ],
                // formAreaInfo:'.formPreview',
                formAreaInfo: 'html',
                temDate: '.temDate',
                uploadFileBtn: '.uploadFileBtn',
                uploadImgBtn: '.uploadImgBtn',
                richTextArea: '.richTextArea',
                selectInput: '.selectInput',
                radioOptionCont: '.radioOptionCont',
                dataLexiTree: '.dataLexiTree',
                selectorBtn: '.selectorBtn',
            },
            temQuery = new propsHandle(),  // 实例化模板功能部分
            form = layui.qbdmsForm;
        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        $(".subContTem").hide()
        // 子表初始化事件
        temQuery.initSubEvent(defProps, serverPath, setter);
        var dateTimeFiledLen = $(".dateTimeFiled");
        for (var i = 0; i < dateTimeFiledLen.length; i++) {
            laydate.render({
                elem: dateTimeFiledLen[i] //指定元素
                , type: 'date'
                , trigger: 'click'
            });
        }


        <#if baseInfo.selectOpenMode?? && baseInfo.selectOpenMode>
        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        });
        <#else>
        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '<#noparse>${ctx}</#noparse>/${baseInfo.moduleName}/${baseInfo.classForPrefix}/view/list';
        });
        </#if>

        var runId = "<#noparse>${runId}</#noparse>";
        if(runId == null || runId == ''){
            $("#hideAndShow").show();
        }

        var common = layui.common;
        var index = parent<#if baseInfo.showFull?? && baseInfo.showFull>.parent</#if>.layer.getFrameIndex(window.name);
        common.updateForm({
            name:'${baseInfo.classForPrefix}DataForm',
            idValue:"<#noparse>${</#noparse>${baseInfo.primaryKey.attrNameForProperty}}",
            primary:"${baseInfo.primaryKey.attrNameForProperty}",
            getCallback: function (data) {
                $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</span>");
            },
            updateCallback:function (data) {
                if (publicMethods._filterRecord(data)) {
                    if ($(".privateSubmit")) {
                        $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
                    }
                    layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'}, function (index) {
                        layer.close(index);

                        <#if baseInfo.selectOpenMode?? && baseInfo.selectOpenMode>
                        //关闭当前页面
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                        parent.window.Initialization()
                        <#else>
                        //关闭当前页面
                        $("#closeWindow,.closeWindow").click(function () {
                            window.location.href = '<#noparse>${ctx}</#noparse>/${baseInfo.moduleName}/${baseInfo.classForPrefix}/view/list';
                        });
                        </#if>
                    });
                } else {
                    layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'});
                }
                return false;
            }
        });
    <#if selectFlow?? && selectFlow != "">
        $("#run").click(function () {
            <#list baseInfo.columns as column>
                var ${column.attrNameForProperty} = $("input[name='${column.attrNameForProperty}']").val();
            </#list>
        var nowData = {<#list baseInfo.columns as column><#if !column_has_next>"${column.attrNameForProperty}": ${column.attrNameForProperty}<#else>"${column.attrNameForProperty}": ${column.attrNameForProperty},</#if></#list>};
            $.ajax({
                url:serverPath.workflowPath+"/${baseInfo.moduleName}/${baseInfo.classForPrefix}/run",
                type: "post",
                dataType: 'json',
                contentType : 'application/json',
                data: JSON.stringify(nowData),
                success : function (data) {
                    if (common.filterRecord(data)) {
                        window<#if baseInfo.showFull?? && baseInfo.showFull>.parent</#if>.parent.layer.alert(data.msg, function (index) {
                            parent<#if baseInfo.showFull?? && baseInfo.showFull>.parent</#if>.layer.close(index);
                            window<#if baseInfo.showFull?? && baseInfo.showFull>.parent</#if>.location.href = '<#noparse>${ctx}</#noparse>/${baseInfo.moduleName}/${baseInfo.classForPrefix}/view/list';
                        });
                    } else {
                        window<#if baseInfo.showFull?? && baseInfo.showFull>.parent</#if>.parent.layer.alert(data.msg);
                    }
                    return false;
                },
                error : function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.alert("启动失败！" + XMLHttpRequest.status);
                }
            })
        })
    </#if>

        publicMethods.bottomFixd()
        form.on('select', function (data) {
            publicMethods.bottomFixd()
        });
        form.render();
    });
</script>
</body>
</html>